<?php

include_once '../@base/portal.php';
include_once '../login/login.php';
// include_once('functions');

$filter = $post->filter;
$user = $post->user;
$login = login($user->number, $user->passwd);
if ($login['status'] == 0 && $login['userbase']['level'] > 0) {
    output(doQuery($filter));
} else {
    return [
        "status" => 1,
    ];
}
function doQuery($filter)
{
    //$sql = "SELECT clientName, clientGroup, clientOffice, clientRank, seat, sector, eventTime, category, item, value, userName, userGroup, userOffice FROM oprec_rectify_record WHERE eventTime >= '{$filter->startTime}' AND eventTime<='{$filter->endTime}' AND status = 0";
    $sql = "SELECT * FROM oprec_rectify_record WHERE eventTime >= '{$filter->startTime}' AND eventTime<='{$filter->endTime}' AND status = 0";
    //logfile
    // logfile('QUERY_RECTIFY_LITE', $sql);
    //exec
    $result = exec_sql($sql);
    if ($result && count($result) > 0) {
        return [
            'status' => 0,
            'content' => $result,
        ];
    }
    return [
        'status' => 2,
    ];
}

/*
SELECT number, clientName, clientGroup, clientOffice, clientRank, seat, sector, partners, attributes, eventTime, category, item, value, description, userName, userGroup, userOffice, submitTime, status FROM oprec_rectify_record WHERE 1
 */
